package com.ibuonline.b2b.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

import com.ibuonline.b2b.common.SysCache;

public class CompanyRecruitment implements Serializable {

	private static final long serialVersionUID = 4015310309077313666L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer companyId;
	private java.lang.String job;
	private java.lang.String title;
	private java.lang.Integer catId;
	private java.lang.Integer validDays;
	private java.lang.Integer recuitNum;
	private java.lang.String workplace;
	private java.lang.Integer type;
	private java.lang.Integer education;
	private java.lang.Integer experience;
	private java.lang.Integer salary;
	private java.lang.String descr;
	private java.lang.String contact;
	private java.lang.String nopassReason;
	private java.lang.String status;
	private java.sql.Timestamp createTime;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public CompanyRecruitment() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getCompanyId() {
		return companyId;
	}
	public java.lang.String getJob() {
		return job;
	}
	public java.lang.String getTitle() {
		return title;
	}
	public java.lang.Integer getCatId() {
		return catId;
	}
	public java.lang.Integer getValidDays() {
		return validDays;
	}
	public java.lang.Integer getRecuitNum() {
		return recuitNum;
	}
	public java.lang.String getWorkplace() {
		return workplace;
	}
	public java.lang.Integer getType() {
		return type;
	}
	public java.lang.Integer getEducation() {
		return education;
	}
	public java.lang.Integer getExperience() {
		return experience;
	}
	public java.lang.Integer getSalary() {
		return salary;
	}
	public java.lang.String getDescr() {
		return descr;
	}
	public java.lang.String getContact() {
		return contact;
	}
	public java.lang.String getNopassReason() {
		return nopassReason;
	}
	public java.lang.String getStatus() {
		return status;
	}
	public java.sql.Timestamp getCreateTime() {
		return createTime;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setCompanyId(java.lang.Integer companyId) {
		this.companyId = companyId;
	}
	public void setJob(java.lang.String job) {
		this.job = job;
	}
	public void setTitle(java.lang.String title) {
		this.title = title;
	}
	public void setCatId(java.lang.Integer catId) {
		this.catId = catId;
	}
	public void setValidDays(java.lang.Integer validDays) {
		this.validDays = validDays;
	}
	public void setRecuitNum(java.lang.Integer recuitNum) {
		this.recuitNum = recuitNum;
	}
	public void setWorkplace(java.lang.String workplace) {
		this.workplace = workplace;
	}
	public void setType(java.lang.Integer type) {
		this.type = type;
	}
	public void setEducation(java.lang.Integer education) {
		this.education = education;
	}
	public void setExperience(java.lang.Integer experience) {
		this.experience = experience;
	}
	public void setSalary(java.lang.Integer salary) {
		this.salary = salary;
	}
	public void setDescr(java.lang.String descr) {
		this.descr = descr;
	}
	public void setContact(java.lang.String contact) {
		this.contact = contact;
	}
	public void setNopassReason(java.lang.String nopassReason) {
		this.nopassReason = nopassReason;
	}
	public void setStatus(java.lang.String status) {
		this.status = status;
	}
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof CompanyRecruitment))
			return false;

		final CompanyRecruitment companyRecruitment = (CompanyRecruitment)other;
		if (!this.id.equals(companyRecruitment.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("CompanyRecruitment[")
			.append("id=").append(id).append(", ")
			.append("companyId=").append(companyId).append(", ")
			.append("job=").append(job).append(", ")
			.append("title=").append(title).append(", ")
			.append("catId=").append(catId).append(", ")
			.append("validDays=").append(validDays).append(", ")
			.append("recuitNum=").append(recuitNum).append(", ")
			.append("workplace=").append(workplace).append(", ")
			.append("type=").append(type).append(", ")
			.append("education=").append(education).append(", ")
			.append("experience=").append(experience).append(", ")
			.append("salary=").append(salary).append(", ")
			.append("descr=").append(descr).append(", ")
			.append("contact=").append(contact).append(", ")
			.append("nopassReason=").append(nopassReason).append(", ")
			.append("status=").append(status).append(", ")
			.append("createTime=").append(createTime).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}

	///####
	private String catName;
	private Integer moreRecuitNum;
	private Timestamp expiredTime;
	private List<String> contacts;
	private String grade;
	
	public String showCatName() {
		ProdCategory cat = SysCache.getCategory(catId);
		if(cat != null) {
			return cat.getName();
		}
		return null;
	}
	
	public boolean isFilter() {
		//if(title.indexOf(str))
		return false;
	}
	
	public String getWorkType() {
		return SysCache.getOptionName("RecuitType", type+"");
	}
	
	public String getEdu() {
		return SysCache.getOptionName("RecuitEdu", education+"");
	}
	
	public String getExp() {
		return SysCache.getOptionName("Experience", experience+"");
	}
	
	public String getSaly() {
		return SysCache.getOptionName("Salary", salary+"");
	}
	
	public String getCatName() {
		return catName;
	}

	public void setCatName(String catName) {
		this.catName = catName;
	}

	public Timestamp getExpiredTime() {
		return expiredTime;
	}

	public void setExpiredTime(Timestamp expiredTime) {
		this.expiredTime = expiredTime;
	}

	public List<String> getContacts() {
		return contacts;
	}

	public void setContacts(List<String> contacts) {
		this.contacts = contacts;
	}

	public Integer getMoreRecuitNum() {
		return moreRecuitNum;
	}

	public void setMoreRecuitNum(Integer moreRecuitNum) {
		this.moreRecuitNum = moreRecuitNum;
	}

	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}
}
